#ifndef OTHERAM_H_
#define OTHERAM_H_
#include <string>
#include <algorithm>
#include <iostream>

using namespace std;
		
class OtherAM
{
public:
	
	static Category cat;
	static vector<Cart_item> items;
	static vector<Product> prods;
	static vector<Category> cats;
	static vector<Cart> carts;
	static vector<Customer> custs;
		
	OtherAM(){}
	
	static void change(vector<Product> *prods)
	{
		int p_id;
		double p_price;
		cout<<"\n Enter the product ID whose price you wish to modify : ";
		cin>>p_id;
		for(int i=0;i<prods->size();i++)
		{
			if (p_id==prods->at(i).prod_id)
			{
				cout<<"\n enter updated price";
				cin>>p_price;
				prods->at(i).prod_price=p_price;
				prods->push_back(prods->at(i));
			}
		}
	}

	static void delete_prod(vector<Product> *prods, vector<Category> cats)
	{	
		int cat_id;
		cout<<"\n enter the category whose product you wish to delete : ";
		cin>>cat_id;
		vector<Product>::iterator it = prods->begin();
		for(int i=0;i<prods->size();i++)
		{ 
			if(cat_id==prods->at(i).cat_id)
			{
				prods->erase(it);
			}
			it++;
		}
	}
	
	static void update(vector<Category> *cats) 
	{
		string cat_name= "";
		int cat_id;
		cat_id = cats->at(cats->size()-1).cat_id + 10;
		cout<<"\n Enter the new category- ";
		cin>>cat_name;
		cout<<"\n Enter the category ID ";
		cin>>cat_id;
		Category cat(cat_id,cat_name);
		cats->push_back(cat);
	}	
	
};

#endif //OTHERAM_H_
